﻿namespace SimpleWebServices.Reflection
{
    using System;
    using System.Reflection;
    using System.Runtime.Serialization;
    using Xunit;

    public sealed class MemberInfoExtensionMethodsFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(typeof(MemberInfoExtensionMethods).IsStatic());
        }

        [Fact]
        public void op_HasAttribute_MemberInfo_TypeFalse()
        {
            Assert.False(typeof(ArithmeticException).HasAttribute(typeof(DataContractAttribute)));
        }

        [Fact]
        public void op_HasAttribute_MemberInfo_TypeTrue()
        {
            Assert.True(typeof(ArithmeticException).HasAttribute(typeof(SerializableAttribute)));
        }

        [Fact]
        public void op_HasAttribute_MemberInfo_TypeNull()
        {
            Assert.Throws<ArgumentNullException>(() => typeof(ArithmeticException).HasAttribute(null));
        }

        [Fact]
        public void op_HasAttribute_MemberInfoNull_Type()
        {
            Assert.Throws<ArgumentNullException>(() => (null as MemberInfo).HasAttribute(typeof(SerializableAttribute)));
        }
    }
}